<?php
namespace app\wxapp\controller;

use app\model\Record; 
use app\model\Theme; 
use app\model\Worker; 
use app\model\Fans; 
use app\model\Order; 
use app\model\Relation; 

class Yxpay extends Base
{
    public function Yxpay()
    { 

global $_G, $_P;
$fans = $this->checkuser();
// $system=$_G['system'];
$system=$_G['system'];
$themeid = intval($_P['themeid']);
$theme = Theme::getThemeByIdxcx($themeid);
if(empty($theme['id'])){
    $this->result(1, '活动入口不正确'); 
    exit;
}
$config =   Theme::getConfig($themeid);

$joinid   = intval($_P['joinid']);
    // URL参数
        // 10补余款
        // 999邀请好友
        // 11我的定单
        // 12核销定单
        // 1开新团
        // 2加入团
        // 3单买
$renshu=0;
if ($joinid==1) {
    $joinid=0;
}elseif ($joinid==2) {
    $joinid=1;
}elseif ($joinid==3) {
    $joinid=9;
}elseif ($joinid==10){
    $joinid=8;    
    $yukuan=1;
}elseif ($joinid==4) {
    $joinid = 4;
    $renshu = 1;
}else{
    $joinid=0;
}


//未支付的进行较验是否已支付
Order::checkorder($themeid,$config,$system);

$recordid   = intval($_P['recordid']);
if (!empty($recordid) && $joinid==1) {
    $count = Record::getAttendDetailNumByPId($recordid);
    if ($showrecord['renshu'] == 1) {
        $groupprice = $config['groupprice2'];
        $maxcount = $config['maxcountall2']-1;
        $maxcountall = $config['maxcountall2'];
    }else{
        $groupprice = $config['groupprice'];
        $maxcount = $config['maxcount'];
        $maxcountall = $config['maxcountall'];
    }
    $nowgroupneednum=max(0,$maxcount-$count);
    if ($nowgroupneednum<=0 && $config['tuanmode']==0) {
        $this->result(1, '此团已满，无法加入！'); 
        exit;
    }
}
        $type = isset($_P['type']) ? intval($_P['type']) : 0;
// $forward   = $_P['forward'];
$pm = array(":uniacid"=>$_G['mpid'],":themeid"=>$themeid);
$p = array(":openid"=>$_G['openid'],":themeid"=>$themeid,":uniacid"=>$_G['mpid']);

if ($config['wuxian']==0) {
    $pself = array(":openid"=>$_G['openid'],":themeid"=>$themeid);
    $pself[':pid'] = $pid;
    $myrecord = db_find ( "SELECT * FROM " . tablename (t_record) . "
                                WHERE themeid =:themeid and pid = :pid
                                        and openid = :openid and status > 0 order by id desc limit 1",$pself);
    if(!empty($myrecord)){
        $this->result(1, '每人限购一次'); 
        exit;
    }  
} 

    if($theme['status']==0){
        $this->result(1, '活动未开始'); 
        exit;
    }
    if($theme['status']==2){
        $this->result(1, '活动已结束'); 
        exit;
    }
    // $uid = $_G['member']['uid'];
 //    $dbfans = Fans::getByTheme($themeid,$_G['openid']);
    // if($dbfans['status']!=1){
    //  $result=  array();
    //  $result['errcode'] = 1;
    //  $result['msg'] = '请稍后再试';
    //  return_msg($result, '', 'ajax');
    // }
 //    $workerid = intval($_P['workerid']);
 //    if ($workerid==0){
 //        $relation = Relation::getByThemeId($themeid,$_G['openid']);
 //        $workerid = $relation['workerid'];
 //    }
 //    $fromuid = intval($_P['fromuid']);
    // $fopenid = $_P['fopenid'];
    // if($fromuid == $_G['member']['uid'] || $fopenid == $_G['openid']){
    //     $fromuid = 0;
    //     $fopenid = "";
    // }
    // if($fopenid == "" || $fromuid == 0){
        $isupdaterelation=false;
        $relation = Relation::getByThemeId($themeid,$_G['openid']);
        if(!empty($relation)){
            $fromuid = $relation['parentid'];
            $fopenid = $relation['popenid'];
            $workerid = $relation['workerid'];
        }

        $myworker = Worker::getThemeWorkerByOpenid($_G['openid'],$themeid,1);
        if (empty($myworker)){
            //如果来源为员工,则业绩给员工
            if (!empty($fromuid)){
                $theyworker = Worker::getThemeWorkerByUid($fromuid,$themeid,1);
                if (!empty($theyworker)){
                    $fromuid = $theyworker['uid'];
                    $fopenid = $theyworker['openid'];
                    $workerid = $theyworker['uid'];
                    $isupdaterelation=true;
                }
            }
            //如果来源为空,则给员工
            if (empty($fromuid) && !empty($workerid)){
                $theyworker = Worker::getThemeWorkerByUid($workerid,$themeid,1);
                $fromuid = $theyworker['uid'];
                $fopenid = $theyworker['openid'];
                $isupdaterelation=true;
            }
            //如果员工为空,则给来源所属员工
            if (!empty($fopenid) && empty($workerid)){
                $theyfrom = Relation::getByThemeId($themeid,$fopenid);
                $workerid = $theyfrom['workerid'];
                $isupdaterelation=true;
            }

            //在没有开启附近团的情况,当团员报名时,员工业绩归属与团长一致
            if ($config['isrecent']==0 && $recordid > 0 && $joinid == 1){
                $record = Record::getAttendGroupById($recordid);
                if (!empty($record['workerid'])){
                    $workerid = $record['workerid'];
                    $isupdaterelation=true;
                }
            }
            if ($isupdaterelation==true){
                    Relation::update($relation['id'],array('parentid' => $fromuid,'popenid' => $fopenid,'workerid' => $workerid));
            }
        }else{
            $fromuid = $_G['member']['uid'];
            $fopenid = $_G['openid'];
            $workerid = $_G['member']['uid'];
            if (empty($config['isworkerpay'])){
                if ($config['isxianxia']==1){
                    $temptxt = "员工不可以报名,如需测试请用非员工微信,如需帮客户下单请用线下录入";
                }else{
                    $temptxt = "员工不可以报名,如需测试请用非员工微信";
                }
                $this->result(1, $temptxt); 
                exit;
            }


        }

    //}

    if (empty($yukuan)) {
        $username = $_P['username'];
        $mobile   = $_P['mobile'];
        $option   = $_P['option'];
        $jiagetype   = $_P['jiagetype'];
        if ($system['gift']==1) {
           $giftidsvalue  = (array)$_P['address'];

           $giftids = serialize($giftidsvalue);
            $address = "";
            foreach ($giftidsvalue as $index => $id){
                
                $gift = db_find("SELECT * FROM ".tablename(t_gift)." WHERE id = ". $id);
                if (!empty($gift)){
                    if($index != 0){
                        $address.= "|";
                    }
                    $num = $index + 1 ;
                    $address.= $num .".". $gift['giftname'];
                }
            }

        }else{
           $address  = $_P['address'];
        }
        // $code     = $_P['code'];
        $datetime = $_P['datetime'];
    }else{
        $p3 = array(":openid"=>$_G['openid'],":themeid"=>$themeid);
        $recordinfo = db_find ( "SELECT * FROM " . tablename (t_record) . "
                                WHERE themeid =:themeid
                                        and openid = :openid order by id desc limit 1",$p3);
        $username = $recordinfo['username'];
        $mobile   = $recordinfo['mobile'];
        $option   = $recordinfo['option'];
        $address  = $recordinfo['address'];
        $datetime = $recordinfo['datetime'];
    }
    $username=preg_replace('#[^\x{4e00}-\x{9fa5}A-Za-z0-9_,，\-]#u','',$username);
    $mobile=preg_replace('#[^0-9]#u','',$mobile);
    $option=preg_replace('#[^\x{4e00}-\x{9fa5}A-Za-z0-9_,|，\-]#u','',$option);
    $address=preg_replace('#[^\x{4e00}-\x{9fa5}A-Za-z0-9_,，\-]#u','',$address);
    $datetime=preg_replace('#[^\x{4e00}-\x{9fa5}A-Za-z0-9_,，\-]#u','',$datetime);

    if(empty($username)){
        $this->result(1, '姓名为空'); 
        exit;
    }elseif(empty($mobile)){
        $this->result(1, '电话为空'); 
        exit;
    }elseif(mb_strlen($mobile,"utf-8")!=11){
        $this->result(1, '请输入11位手机号'); 
        exit;
    }
    // if(empty($system['appid']) || empty($system['mchid'] )){
    //     $this->result(1, '姓名为空'); 
    //     exit;
    // }
    $fee  = 0;
    $pid  = 0;
    $desclen=26;
    if (!empty($theme['mobile'])){
        $desc = "【客服".$theme['mobile']."】";
        $desclen = $desclen-mb_strlen($desc);
    }
    if (!empty($theme['jubf']) ){
        $desc = mb_substr($theme['jubf'],0,$desclen,"UTF-8").$desc;
    }else{
        $desc = mb_substr($theme['title'],0,$desclen,"UTF-8").$desc;
    }

    if($joinid == 2 && $config['isgoon']==1){//继续开团
        if($config['groupsum'] >0){
            $ktcount = Record::getHasAttendNumByThemeId($themeid);
            if($ktcount >= $config['groupsum']){
                $this->result(1, '最大开团数量为'.$config['groupsum']); 
                exit;
            }
        }
        $ingrecord = Record::getIngByOpenId($_G['openid'],$themeid);
        if(!empty($ingrecord)){
            $this->result(1, '您有正在拼团中的定单'); 
            exit;
        }
        $type = 0;

        if ($config['joinfee']=='0.00'){
            if ($renshu == 1) {
                $fee = floatval($config['groupprice2']);
            }else{
                $fee = floatval($config['groupprice']);
            }
        }else{
            $fee  = floatval($config['joinfee']);
        }
        if ($system['jiage']>0) {
            if ($jiagetype == $config['joinname']) {
                $fee  = floatval($config['joinfee']);
            } elseif ($jiagetype == $config['joinname2']) {
                $fee  = floatval($config['joinfee2']);
            }elseif ($jiagetype == $config['joinname3']) {
                $fee  = floatval($config['joinfee3']);
            }
        }
        
    }else{
        if($joinid == 2){
            $this->result(1, '刷新后再重试'); 
            exit;
        }
        if($recordid > 0 && $joinid == 1){//团员参团
            $type = 1;

            $record = Record::getPayedGroupById($recordid,$themeid);
            if(empty($record)){
                $this->result(1, '没有团长信息 ID：'.$recordid); 
                exit;
            }
            // if($record['openid'] == $_G['openid'] ){
            //     $result=  array();
            //     $result['errcode'] = 1;
            //     $result['msg'] = '您是团长 不可以再成为本团团员 ID：'.$recordid;
            //     return_msg($result, '', 'ajax');
            // }

            if ($config['joinfee']=='0.00'){
                if ($record['renshu'] == 1) {
                    $fee = floatval($config['groupprice2']);
                }else{
                    $fee = floatval($config['groupprice']);
                }
            }else{
                $fee  = floatval($config['joinfee']);
            }
            if ($system['jiage']>0) {
                if ($jiagetype == $config['joinname']) {
                    $fee  = floatval($config['joinfee']);
                } elseif ($jiagetype == $config['joinname2']) {
                    $fee  = floatval($config['joinfee2']);
                }elseif ($jiagetype == $config['joinname3']) {
                    $fee  = floatval($config['joinfee3']);
                }
            }
        
            if ($record['renshu'] == 1) {
                $renshu  = 1;
            }

            //$desc = '活动拼团';
            $pr = $pm;
            $pr[':id'] = $recordid;
            $pid = $recordid;

            $count = Record::getAttendDetailNumByPId($recordid);
            $neednum = intval($config['maxcount']);
            if($count >= $neednum && $config['maxcount']==0 ){
                $this->result(1, '来晚一步,此团已满!'); 
                exit;
            }

        }else{//团长开团
            $joinid == 9?$type = 9:$type = 0;
            if ($config['joinfee']=='0.00'){
                if ($joinid == 9){
                    $fee = floatval($config['primeprice']);
                }else{
                    if ($renshu == 1) {
                        $fee = floatval($config['groupprice2']);
                    }else{
                        $fee = floatval($config['groupprice']);
                    }
                }
                
            }else{
                $fee  = floatval($config['joinfee']);
            }
            if ($system['jiage']>0) {
                if ($jiagetype == $config['joinname']) {
                    $fee  = floatval($config['joinfee']);
                } elseif ($jiagetype == $config['joinname2']) {
                    $fee  = floatval($config['joinfee2']);
                }elseif ($jiagetype == $config['joinname3']) {
                    $fee  = floatval($config['joinfee3']);
                }
            }
        
            $myrecord = db_find ( "SELECT * FROM " . tablename (t_record) . "
                                    WHERE uniacid = :uniacid and themeid =:themeid
                                            and openid = :openid and type = 0 and status > 0 order by id desc limit 1",$p);
            // if(!empty($myrecord)){
            //     $result=  array();
            //     $result['errcode'] = 1;
            //     $result['msg'] = '您是团长 不可以再开团啦';
            //     return_msg($result, '', 'ajax');
            // }
            //groupsum
            if($config['groupsum'] >0){
                $ktcount = intval(db_fetchcolumn ( "SELECT COUNT(*) FROM  " . tablename ( t_record ) . "
                                WHERE uniacid = :uniacid and themeid =:themeid and type = 0",$pm));
                if($ktcount >= $config['groupsum']){
                    $this->result(1, '最大开团数量为'.$config['groupsum']); 
                    exit;
                }
            }
        }
    }


    //在线加盟补余款
    if($type == 0 && $system['softstyle']==5){
        $record = db_find ( "SELECT * FROM " . tablename (t_record) . "
                        WHERE uniacid = :uniacid and themeid =:themeid
                        and openid = :openid and type = 9 and status = 1 order by id desc limit 1",$p);
        if (!empty($record)){
            $fee = $fee - $record['fee'];
        }
        if($fee <=0 ){
            $this->result(1, '支付金额不可小于0元'); 
            exit;
        }
    }

    //补余款
    if ($config['yukuan']>0 && TIMESTAMP>$config['yukuantime']){
        if (empty($yukuan)) {
            $fee = $config['yukuan'];
        }else{
            $orderpay = db_fetchcolumn ( 'SELECT sum(realfee) FROM ' . tablename ( t_order ) . "
                WHERE themeid = '{$themeid}' and paystate = 1 and realfee > 0 and uid='{$_G['member']['uid']}'" );
            $fee = sprintf("%.2f",$config['yukuan'] - $orderpay);
            $type = 8;
        }
    }


    if($fee <=0 && $type == 1){
        $this->result(1, '参团支付金额不可小于0元'); 
        exit;
    }
    
    $uncode = $themeid.'-'.TIMESTAMP.rand(1000,1000000);
    if($theme['iskj']==1){

    }else{
        $uncode = $themeid.'-'.TIMESTAMP.rand(1000,1000000);
    }
    
    if($type == 1){//团员参团
        $pself = $p;
        $pself[':pid'] = $pid;
        $myrecord = db_find ( "SELECT * FROM " . tablename (t_record) . "
                                    WHERE uniacid = :uniacid and themeid =:themeid and pid = :pid
                                            and openid = :openid and type = 1 and status > 0 order by id desc limit 1",$pself);
        if(!empty($myrecord)){
            $this->result(1, '已经参团啦'); 
            exit;
        }
        
     //    if($config['istzcy'] == 0){//团长不能参团
     //        $record = db_find ( "SELECT * FROM " . tablename (t_record) . "
                    // WHERE uniacid = :uniacid and themeid = :themeid 
     //                        and type = 0 and openid = :openid and status > 0 order by id desc limit 1",$p);
     //        if(!empty($record)){
     //            $result=  array();
     //            $result['errcode'] = 1;
     //            $result['msg'] = '本次活动团长不能再拼其他团啦';
     //            return_msg($result, '', 'ajax');
     //        }
     //    }
        
     //    if($config['istycy'] == 0){//团员只能参加一次
     //        $sql = "SELECT * FROM " . tablename (t_record) . "
                    // WHERE uniacid = :uniacid and themeid = :themeid  and type = 1 and openid = :openid and status > 0 order by id desc limit 1";
     //        $record = db_find ( $sql,$p);
     //        if(!empty($record)){
     //            $result=  array();
     //            $result['errcode'] = 1;
     //            $result['msg'] = '本次活动只能参加一个团哦';
     //            return_msg($result, '', 'ajax');
     //        }
     //    }
    }else{

    }

    //load_model('mc');
    member_update($_G['member']['uid'],array('mobile' => $mobile,'realname'=>$username));

    //自动更新档案信息
    $data = array(
        'username' => $username,
        'mobile'   => $mobile,
        'addtime'  => TIMESTAMP,
        'address'  => $address,
        'datetime' => $datetime,
        'option'   => $option,
        'jiagetype'   => $jiagetype,
        'fromuid'  => $fromuid,
        'fopenid'  => $fopenid,
        'workerid'  => $workerid,
    );

    if ($system['hdget']==1) {
        if (Fans::getuid_old($fromuid,$themeid)) {
            $data['fromuid_old']  = $fromuid;
            $data['fopenid_old']  = $fopenid;
        }
        if (Fans::getuid_old($workerid,$themeid)) {
            $data['workerid_old']  = $workerid;
        }
    }

    $r = db_update(t_fans,$data,array("uid"=>$_G['member']['uid']));


    $data = array(
        'uniacid'  => $_G['mpid'],
        'themeid'  => $themeid,
        'openid'   => $_G['openid'],
        'uid'      => $_G['member']['uid'],
        'nickname' => $fans['nickname'],
        'avatar'   => empty($fans['avatar']) ? $fans['headimgurl']:$fans['avatar'],
        'username' => $username,
        'mobile'   => $mobile,
        'addtime'  => TIMESTAMP,
        'fee'      => $fee,
        'address'  => $address,
        'giftids'  => $giftids,        
        'datetime' => $datetime,
        'jiagetype'   => $jiagetype,
        'option'   => $option,
        // 'code'     => $code,
        'uncode'   => $uncode,
        'status'   => 0,
        'fromuid'  => $fromuid,
        'fopenid'  => $fopenid,
        'workerid'  => $workerid,
        'pid'      => $pid,
        'type'     => $type,
        'renshu'     => $renshu,
    );
    
    if ($system['hdget']==1) {
        if (Fans::getuid_old($fromuid,$themeid)) {
            $data['fromuid_old']  = $fromuid;
            $data['fopenid_old']  = $fopenid;
        }
        if (Fans::getuid_old($workerid,$themeid)) {
            $data['workerid_old']  = $workerid;
        }
    }

    $p3 = $p;
    $p3[':type'] = $type;
    $record = db_find ( "SELECT * FROM " . tablename (t_record) . "
                                    WHERE uniacid = :uniacid and themeid =:themeid
                                            and openid = :openid and type = :type and status = 0 order by id desc limit 1",$p3);
        
    $billcode = '';
    if($joinid==2 && $record['status']>0 ){
        $record = null;
    }
    
    
    if(empty($record)){
        $data['billcode'] = getMillisecond();
        $billcode = $data['billcode'];
        $r = $insertid = db_insert(t_record,$data);
        if(!empty($r)){
            $recordid = $insertid;
        }else{
            $this->result(1, '请重新下单'); 
            exit;
        }
        
        if($system['iswqpay']==1){
            // $result['errcode'] = 0;
            // $result['msg'] = 'success';
            // $result['url'] =   Theme::createwxAppUrl('dopay',array('recordid'=>$recordid));
            // return_msg($result, '', 'ajax');

            $this->result(1, '开启开系统支付'); 
            exit;
        }
        if (($fee ==0 || $fee=='0.00' )&& $type == 0){
            $url = Theme::createwxAppUrl('index',array('themeid'=>$themeid,'recordid'=>$recordid));


            Theme::workerreport($themeid,$workerid,array('record' =>1));
            if ($workerid == $fromuid) {
                Theme::workerreport($themeid,$workerid,array('recordzx' =>1));
            }
            if (!empty($fromuid)) {
                db_query("UPDATE ".tablename(t_fans)." SET tuijian = tuijian + 1 WHERE themeid = '{$themeid}' and uid ={$fromuid}");
            }

            $this->result(1, '报名成功！'); 

            exit;
        }
        
        
    }else{
        $billcode = $record['billcode'];
        if($record['status'] == 0){
            $r = db_update(t_record,$data,array("id"=>$record['id']));
            if(!empty($r)){
                $recordid = $record['id'];
            }else{
                $this->result(1, '请重新下单'); 
                exit;
            }
            if($system['iswqpay']==1){
                $this->result(1, '系统开启系统支付'); 
                exit;
            }
        }elseif($record['status'] == 1){
            $this->result(1, '您已经参团了'); 
            exit;
        }elseif($record['status'] == 2){
            $this->result(1, '您已经核销过'); 
            exit;
        }else{
            $this->result(1, '请联系管理员'); 
            exit;
        }
    }
    $p[':recordid'] = $recordid;
    $order = db_find ( "SELECT * FROM ".tablename(t_order)."
            WHERE uniacid = :uniacid and themeid = :themeid and openid = :openid and realfee>0 and masterid=:recordid",$p);
    $data = array(
            'uniacid'  => $_G['mpid'],
            'ordertype'=> $type,
            'themeid'  => $themeid,
            'openid'   => $_G['openid'],
            'uid'       => $_G['member']['uid'],
            'username' => $username,
            'mobile'   => $mobile,
            'status'   => 0,
            'type'     => 'wechat',
    );
    $data['orderfee'] = $fee;
    $data['masterid'] = $recordid;
    $data['detailid'] = $recordid;
    $orderid = 0;
    $tid = '';
    if(empty($order)){
        $module_item = db_get('yx_sys_modules', ['module_name' => MODULE_NAME, 'themeid' => $themeid]);
            $module_id = empty($module_item['id']) ? '000000' : sprintf("%06d", $module_item['id']);
            $uniontid = date('YmdHis') . $module_id . random(8, 1);
            $billcode = getMillisecond();
        $tid = '0'.$billcode;
        $data['tid'] = $tid;
        $data['addtime'] = TIMESTAMP;
        $data['ordersn'] = $billcode;
        $orderid = Order::save($data);
    }elseif($order['paystate'] == 0){
        // $tid = $order['tid'];
        // $orderid = $order['id'];
        // if(TIMESTAMP - $order['addtime'] > 5*60 || $order['orderfee'] != $fee){
            $data['addtime'] = TIMESTAMP;
            $ordersn = getMillisecond();
            $data['ordersn'] = $ordersn;
            $tid = '2'.$ordersn;
            $data['tid'] = $tid;
        // }
        Order::update($order['id'],$data);
    }elseif($order['paystate'] == 1){
        $this->result(1, '请联系管理员'); 
        exit;
    }else{
        $this->result(1, '请联系管理员'); 
        exit;
    }
    // $result=  array();
    // $result['errcode'] = 0;
    // // $result['orderid'] =  $orderid;
    // $result['tid'] =  $tid;
    // $result['fee'] =  $fee;
    // $result['title'] =  $desc;
    // $result['payway'] = intval($config['payway']);
    // $result['url'] =   Theme::createwxAppUrl('dopay',array('orderid'=>$orderid));
    // return_msg($result, '', 'ajax');


    $params = array('isrecharge'=>false);
    $ordertype = 'theme';

    if(empty($_G['openid']) || empty($_G['member']['uid'])){
        $this->result(1, '用户信息错误'); 
        return;
    }
    // $orderid = intval($_P['orderid']);
    $order = Order::getByIdAndOpenid($orderid,$_G['openid']);
    if(empty($order)){
        $this->result(1, '记录不存在，请重新下单'); 
        exit;
    }
    if($order['status'] != 0){
        $this->result(1, '定单已完成支付'); 
        exit;
    }
    if($order['orderfee'] <= 0){
        $this->result(1, '定单金额必须大于0元'); 
        exit;
    }

    
    $desclen=26;        
    $theme = Theme::getThemeById($order['themeid']);
    if (!empty($theme['mobile'])){
        $desc = "【客服".$theme['mobile']."】";
        $desclen = $desclen-mb_strlen($desc);
    }
    if (!empty($theme['jubf']) ){
        $desc = mb_substr($theme['jubf'],0,$desclen,"UTF-8").$desc;
    }else{
        $desc = mb_substr($theme['title'],0,$desclen,"UTF-8").$desc;
    }
    $title = $desc;

    $params ['tid'] = $order['tid'];
    $params ['user'] = $_G['openid'];
    $params ['fee'] =  $order['orderfee'];
    $params ['title'] = $title;
    $params ['ordersn'] = $order['ordersn'];
    $params ['virtual'] = false;
    
    $pay_params = $this->pay ( $params );
    // $data['params']=$pay_params ;
    if (is_error($pay_params)) {
        return $this->result(1, '支付失败，请重试',$pay_params);
    }
    return $this->result(0, '', $pay_params);
}
}